import { createRouter, createWebHistory } from "vue-router"

//创建路由器
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  //管理路由
  routes: [  //一个一个的路由规则
    {
      path: '/',
      redirect: '/login' ,// 将根路径重定向到/login
      
    }
    ,
    {
      path: '/home',
      name: 'home',
      component: () => import('@/views/home/HomeIndex.vue'),
    }
    , {
      //路径
      path: '/login',
      name: 'login',
     
      //组件绑定
      component: () => import('@/views/login/Login.vue')
    },

    {
      path: '/sign',
      name: 'sign',
      component: () => import('@/views/sign/SignIndex.vue')
    },
    {
      path: '/blog',
      name: 'blog',
      component: () => import('@/views/blog/BlogIndex.vue'),
    },
    {
      path: '/blog/write',
      name: 'blogwrite',
      component: () => import('@/views/blog/blogWrite.vue')
    },
    {
      path: '/blog/detail/:id',
      name: 'blogDetail',
      component: () => import('@/views/blog/BlogDetail.vue')
    },
    {
      path: '/person',
      name: 'person',
      component: () => import('@/views/person/PersonIndex.vue'),
 
    },
    {
      path: '/my-class',
      name: 'myClass',
      component: () => import('@/views/myClass/index.vue'),
    },
    {
      path: '/learning-progress',
      name: 'learningProgress',
      component: () => import('@/views/learning-progress/index.vue'),
    },
    {
      path: '/status',
      name: 'status',
      component: () => import('@/views/status/recentStatus.vue'),
 
    },
    {
      path: '/visualization',
      name: 'visualization',
      component: () => import('@/views/visualization/VisualizationIndex.vue'),
    },
    {
      path: '/robot',
      name: 'robot',
      component: () => import('@/views/robot/robot.vue'),
    },
    {
      path: '/learning/vue-advanced',
      name: 'VueAdvanced',
      component: () => import('@/views/learning/VueAdvanced.vue')
    },
    {
      path: '/learning/spring-boot',
      name: 'SpringBoot',
      component: () => import('@/views/learning/SpringBoot.vue')
    },
    {
      path: '/learning/mysql',
      name: 'MySQL',
      component: () => import('@/views/learning/MySQL.vue')
    },
    {
      path: '/learning/algorithm',
      name: 'Algorithm',
      component: () => import('@/views/learning/Algorithm.vue')
    },
    {
      path: '/learning/photoshop',
      name: 'Photoshop',
      component: () => import('@/views/learning/Photoshop.vue')
    }
  ]
})

export default router
